<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<f:view>
	<html>
		<head>
			<script language="JavaScript">
	function set_image(button, img) {
		button.src = img;
	}
</script>

			<link rel="stylesheet" type="text/css" href="<%=path %>stylesheet.css" />

			<title><h:outputText value="ProjectTrack" /></title>
		</head>

		<body>
			<h:form>
				<h:panelGrid columns="2" border="0" cellpadding="3" cellspacing="3">

					<h:graphicImage url="/images/logo.png"
						alt="Welcome to ProjectTrack" title="Welcome to ProjectTrack"
						width="149" height="160" />

					<h:panelGrid columns="3" border="0" cellpadding="5" cellspacing="3"
						headerClass="login-heading" style="text-align:left">


						<f:facet name="header">
							<h:outputText value="ProjectTrack" />
						</f:facet>
						
						<h:messages 	globalOnly = "true"
									styleClass = "errors"	/>
						<h:panelGroup></h:panelGroup>
						<h:panelGroup></h:panelGroup>

						<h:outputLabel for="userNameInput">
							<h:outputText value="Enter your username: " />
						</h:outputLabel>
						<h:inputText	id="userNameInput" 
										size="20" 
										maxlength="30"
										required="true"
										value = "#{authenticationBean.loginName }">
							<f:validateLength minimum="5" maximum="30" />
						</h:inputText>
						<h:message for="userNameInput" styleClass="errors" />

						<h:outputLabel for="passwordInput">
							<h:outputText value="Password: " />
						</h:outputLabel>
						<h:inputSecret	id="passwordInput" 
										size="20" 
										maxlength="30"
										required="true"
										value = "#{authenticationBean.password }">
							<f:validateLength minimum="5" maximum="15" />
						</h:inputSecret>
						<h:message for="passwordInput" styleClass="errors" />

						<h:panelGroup />
						<h:commandButton action="#{authenticationBean.login }" title="Submit"
							image="/images/submit.png"
							onmouseover="set_image(this, '#{facesContext.externalContext.requestContextPath }/images/submit_over.png')"
							onmouseout="set_image(this, '#{facesContext.externalContext.requestContextPath }/images/submit.png');"
							onmousedown="set_image(this, '#{facesContext.externalContext.requestContextPath }/images/submit.png');"
							onmouseup="set_image(this, '#{facesContext.externalContext.requestContextPath }/images/submit_over.png')" />
						<h:panelGroup />

					</h:panelGrid>
				</h:panelGrid>
			</h:form>
		</body>
	</html>
</f:view>
